#delimit;
set more off;

set logtype text;
log using /home/dnc2101/Accidental_Deaths/Vital_Stats/do_files_other_years/logload1983.txt, replace;

/*------------------------------------------------
  This program reads the 1981 NCHS Multiple Cause of Death Data Data File
  by Jean Roth Mon Aug 14 15:53:44 EDT 2006
  Please report errors to jroth@nber.org
  NOTE:  This program is distributed under the GNU GPL.
  See end of this file and http://www.gnu.org/licenses/ for details.
  Run with do mort1981
----------------------------------------------- */;

/* The following line should contain
   the complete path and name of the raw data file.
   On a PC, use backslashes in paths as in C:\  */;

local dat_name "/home/dnc2101/Accidental_Deaths/Vital_Stats/DAT_Files/mort83.dat";

/* The following line should contain the path to your output '.dta' file */;

local dta_name "/home/dnc2101/Accidental_Deaths/Vital_Stats/dta_files_other_years/mort1983";

/* The following line should contain the path to the data dictionary file */;

local dct_name "/home/dnc2101/Accidental_Deaths/Vital_Stats/DCT_Files/mort1983.dct";

infile using "`dct_name'", using("`dat_name'") clear;


/*
Copyright 2006 shared by the National Bureau of Economic Research and Jean Roth

National Bureau of Economic Research.
1050 Massachusetts Avenue
Cambridge, MA 02138
jroth@nber.org

This program and all programs referenced in it are free software. You
can redistribute the program or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
USA.
*/;



compress;

** keep only injury related deaths;

keep if (ucr282>=29900 & ucr282<=35800);


** save smaller file in Stata format;

save "/home/dnc2101/Accidental_Deaths/Vital_Stats/dta_files_other_years/mort1983.dta", replace;

** now keep only the variables I intend to use and save a file for appending onto the other files;
** Running list and description of new variables that get added to the data in years after 1981 - ;
** FIPS state and county codes for place of occurence of death and place of residence of decedent are now in the data starting in 1982;
** the variables and their definitions are the following - ;
** fipsctyo, county occurence, fipssto, state occurence, fipsctyr, county residence, fipsstr, state residence, fipssmsa, metropolitan statistical area of residence - fipssmsa was actually in the 1981 data;

** variable called "origin" enters data in 1983 - not sure what it means, codebook doesn't actually define it, and actually no observations in the data appear to have values or string text entered for it;
** furthermore, occupation and industry of decedent also appears to not be entered for any of the rows although columns for these variables are in the data;


keep datayear rectype restatus countyoc stateoc countyrs staters popsize metro monthdth sex race racer3 racer2 origin age ager52 ager27 ager12 hospstat marstat accident fipsctyo fipssto fipsctyr fipsstr fipssmsa ucod ucr282 ucr72 ucr61 ucr34;

save "/home/dnc2101/Accidental_Deaths/Vital_Stats/Data_For_Appending/short_mort1983.dta", replace;



log close;

